if exists (select 1
            from  sysobjects
           where  id = object_id('bd_temp_import_leave')
            and   type = 'U')
   drop table bd_temp_import_leave
go

/*==============================================================*/
/* Table: bd_temp_import_leave                                  */
/*==============================================================*/
create table bd_temp_import_leave (
   ID                   bigint               identity,
   dept_name            varchar(50)          null,
   offices_name         varchar(50)          null,
   by_company           varchar(50)          null,
   user_no              varchar(50)          not null,
   user_name            varchar(50)          null,
   leave_name           varchar(50)          not null,
   begin_date           date                 not null,
   end_date             date                 not null,
   begin_time           varchar(50)          not null,
   end_time             varchar(50)          not null,
   leave_hours          decimal              not null,
   remark               varchar(2000)        null,
   serial_number        varchar(50)          not null,
   operator             varchar(50)          not null,
   create_time          datetime             null default getdate(),
   constraint PK_BD_TEMP_IMPORT_LEAVE primary key (ID)
)
go

if exists (select 1 from  sys.extended_properties
           where major_id = object_id('bd_temp_import_leave') and minor_id = 0)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '请假-请假导入记录表',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ID')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'ID'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   'ID',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'ID'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'dept_name')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'dept_name'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '部门名称',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'dept_name'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'offices_name')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'offices_name'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '科室名称',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'offices_name'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'by_company')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'by_company'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '所属公司',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'by_company'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'user_no')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'user_no'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '工号',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'user_no'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'user_name')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'user_name'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '姓名',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'user_name'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'leave_name')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'leave_name'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '假类',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'leave_name'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'begin_date')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'begin_date'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '开始日期',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'begin_date'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'end_date')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'end_date'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '结束日期',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'end_date'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'begin_time')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'begin_time'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '开始时间',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'begin_time'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'end_time')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'end_time'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '结束时间',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'end_time'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'leave_hours')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'leave_hours'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '请假总小时数',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'leave_hours'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'remark')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'remark'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '备注',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'remark'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'serial_number')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'serial_number'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '流水号',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'serial_number'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'operator')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'operator'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '导入人',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'operator'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_temp_import_leave')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'create_time')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'create_time'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '数据生成时间',
   'user', @CurrentUser, 'table', 'bd_temp_import_leave', 'column', 'create_time'
go
